##---------------------------------------------REMOVE ALL OBJECTS FROM MEMORY------------------------------------------##
rm(list=ls()) 
## --------------------------------------------- SET WORKING DIRECTORY ------------------------------------------##
setwd("~/WP1")
.libPaths( c( .libPaths(), "~/R/packages/3.1.0") )
## --------------------------------------------- INSTALL AND LOAD PACKAGES --------------------------------------------##
install.packages("car", lib="~/R/packages/3.2.1")
library(car, lib.loc="~/R/packages/3.2.1")
install.packages("reshape", lib="~/R/packages/3.2.1")
library(reshape, lib.loc="~/R/packages/3.2.1")
install.packages("plyr", lib="~/R/packages/3.2.1")
library(plyr, lib.loc="~/R/packages/3.2.1")
install.packages("arm", lib="~/R/packages/3.2.1")
library(arm)
install.packages("mice", lib="~/R/packages/3.2.1")
library(mice)
install.packages("ggplot2", lib="~/R/packages/3.2.1")
library(ggplot2)
install.packages("grid", lib="~/R/packages/3.2.1")
library(grid)
install.packages("RColorBrewer", lib="~/R/packages/3.2.1")
library(RColorBrewer)
library(foreign)
## --------------------------------------------- READING IN DATA FROM A FILE ------------------------------------------##
load("~/WP1/cache/bcs2004_WP1.RData")

## --------------------------------------------- IMPUTATION ------------------------------------------##
imp <-mice(BCS2004, seed=1314, m=40, maxit=20, method=c("norm","norm","norm","logreg","logreg", "logreg",
"polyreg", "logreg","logreg","","logreg","logreg","logreg","logreg","logreg", "logreg","norm","norm","norm","norm", "norm","norm",
"polyreg","polr","polr","polr","logreg","logreg","logreg","logreg","logreg","polr","logreg","logreg",
 "logreg", "logreg","norm","norm", "norm","norm", "logreg", "logreg", "logreg","norm","norm"))
 
 save.image("~/WP1/cache/bcs2004_WP1_Imputed.RData")